#ifndef GAMEOBJECT_H
#define GAMEOBJECT_H

#include "GameEventHandler.h"
#include <list>
#include <string>

class Cell;
class GameObject
{
public:
	GameObject();
	virtual ~GameObject();

	void AddEventHandler(GameEventHandler* handler);
	
	bool CanHandle(GameEvent* gameEvent);
	bool HandleEvent(GameEvent* gameEvent);

	unsigned int CellX() const;
	unsigned int CellY() const;

	void MoveToCell(Cell* newCell, unsigned int cellX, unsigned int cellY);
	
	Cell* GetCell() const;
	void SetNullCell();


	// Test code
	virtual const std::string& ToString() const = 0;

protected:
	void SetCellY(unsigned int cellY);
	void SetCellX(unsigned int cellX);

private:
	void Clear();
	void ClearHandlers();
	void ClearCell();


	std::list<GameEventHandler*> eventHandlers;

	unsigned int cellPositionX, cellPositionY;
	Cell* cell;
};

#endif //GAMEOBJECT_H
